package cn.seecoder.courselearning.vo.course;

import cn.seecoder.courselearning.po.course.Comments;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NonNull;

import java.util.Date;

@Data
public class CommentsVO {

    /**
     * 帖子id
     */
    private Integer id;

    /**
     * 标题
     */
    private String title;

    /**
     * 副标题
     */
    private String subTitle;

    /**
     * 摘要
     */
    private String abstraction;

    /**
     * 课程id
     */
    private Integer courseId;

    /**
     * 创建帖子的时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createTime;

    /**
     * 发表用户id
     */
    private Integer uid;

    /**
     * 用户名字
     */
    private String uname;

    /**
     * 最新回复时间
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date updateT;

    public CommentsVO() {}

    public CommentsVO(@NonNull Comments comments) {
        this.abstraction = comments.getAbstraction();
        this.courseId = comments.getCourseId();
        this.createTime = comments.getCreateTime();
        this.id = comments.getId();
        this.subTitle = comments.getsubTitle();
        this.title = comments.getTitle();
        this.uid = comments.getUid();
        this.uname = comments.getUname();
        this.updateT = comments.getUpdateT();
    }

}
